/*
 *  copy source from lua-5.1.4 to learn lua implementation
 */
#ifndef llimits_h
#define llimits_h


#include <limits.h>
#include <stddef.h>

#include "lua.h"

typedef unsigned char lu_byte;
typedef LUAI_UINT32 lu_int32;
typedef LUAI_UMEM lu_mem;

typedef LUAI_MEM l_mem;

typedef lu_int32 Instruction;

#ifdef lua_assert

#define check_exp(c,e)		(lua_assert(c), (e))
#define api_check(l,e)		lua_assert(e)

#else

#define lua_assert(c)		((void)0)
#define check_exp(c,e)		(e)
#define api_check		luai_apicheck

#endif

#ifndef UNUSED
#define UNUSED(x)	((void)(x))	/* to avoid warnings */
#endif

#ifndef cast
#define cast(t, exp)	((t)(exp))
#endif

#define cast_byte(i)	cast(lu_byte, (i))
#define cast_num(i)	cast(lua_Number, (i))
#define cast_int(i)	cast(int, (i))

#ifndef lua_lock
#define lua_lock(L)     ((void) 0) 
#define lua_unlock(L)   ((void) 0)
#endif

#ifndef MINSTRTABSIZE
#define MINSTRTABSIZE	32
#endif

typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;

#define MAX_SIZET ((size_t)(~(size_t)0)-2)

#ifndef HARDSTACKTESTS
#define condhardstacktests(x) ((void)0)
#else
#define condhardstacktests(x) x
#endif

#endif
